<template>

	<div>

		<div>
			<h2>学生/教师公用修改密码页面</h2>
			输入旧密码：<input type="text" v-model="data.oldPwd" />
			<br>
			<hr>
			输入新密码：<input type="text" v-model="data.newPwd" />
			<br>
			<hr>
			确认密码：<input type="text" v-model="data.newPwd2" />
			<br>
			<hr>
			<button @click="updatePwd()">确认修改</button>

		</div>

	</div>

</template>

<script setup>

	import {ref,reactive,onMounted} from 'vue';
	import {$get} from '@/ajax';
	import {$postj} from '@/ajax';
	
	
	const data = reactive({
		
		oldPwd:'',
		newPwd:'',
		newPwd2:'',
		
	})
	
	
	function updatePwd(){  //修改密码
	
		let fd = new FormData();
		
		console.log("oldPwd == " + data.oldPwd)
		console.log("newPwd == " + data.newPwd)
		console.log("newPwd2 == " + data.newPwd2)
		
		console.log("--------")
		
		if(data.newPwd == data.newPwd2){
			
			let pwd = {oldPwd:data.oldPwd , newPwd:data.newPwd}
			console.log(pwd)
			$postx("/api/user/updatePwd",pwd)
			.then((resp)=>{
				console("修改密码成功")
			})
		
		}
		

		
		
	}

</script>

<style>
</style>
